package com.woniuxy.springparking.service.Impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.woniuxy.springparking.common.RestResult;
import com.woniuxy.springparking.dao.TPerAuthDao;
import com.woniuxy.springparking.pojo.TPerAuth;
import com.woniuxy.springparking.service.TPerAuthService;
import com.woniuxy.springparking.vo.TPerAuthVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class TPerAuthServiceImpl implements TPerAuthService {
    @Autowired
    private TPerAuthDao tPerAuthDao;
    @Override
    public RestResult findTAByPage(TPerAuthVo taVo) {
        Page<Object> pages= PageHelper.startPage(taVo.getPage(),taVo.getLimit());
        List<TPerAuth> data=this.tPerAuthDao.selectTAByPage(taVo);
        return new RestResult(pages.getTotal(),data);
    }

    @Override
    public void updateAuth(Integer perAuthStatus, Integer perAuthId) {
        this.tPerAuthDao.updateStatus(perAuthStatus,perAuthId);
    }
}
